#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
typedef long long LL;
int p[] = { 2,3,5,7,11,13,17,19,23,29 }, n;
LL a = 1; int d = 1;

void f(LL c, int s, int e, int i) {
    if (s > d || (s == d && c < a))d = s, a = c;
    if (i > 9)return;
    for (int k = 1; k <= e; k++) {
        if (c > n / p[i])break;
        f(c *= p[i], s * (k + 1), k, i + 1);
    }
}

int main() {
    scanf("%d", &n);
    f(1, 1, 30, 0);
    printf("%lld", a);
    return 0;
}